<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Amaze UI Admin form Examples</title>
  <meta name="description" content="这是一个form页面">
  <meta name="keywords" content="form">
<% include("/common/inc/_css.html"){} %>
</head>
<body>
<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
  以获得更好的体验！</p>
<![endif]-->

<% include("/common/inc/_header.html"){} %>

<% include("/common/inc/_function.html"){} %>
  <!-- sidebar end -->

<!-- content start -->
<div class="admin-content">
  <div class="admin-content-body">
    <div class="am-cf am-padding am-padding-bottom-0">
      <div class="am-fl am-cf">
        <strong class="am-text-primary am-text-lg">菜单管理</strong> /
        <small>form</small>
      </div>
    </div>

    <hr>
          <form class="am-form" method="post" id="doc-vld-msg">
          <fieldset>
            <div class="am-g am-margin-top-sm">
              <div class="am-u-sm-4 am-u-md-2 am-text-right">
                	菜单编码:
              </div>
              <div class="am-u-sm-8 am-u-md-4 am-u-end">
                <input type="text" class="am-input-sm" name="username" id="doc-vld-name" minlength="2" required>
              </div>
            </div>
            <div class="am-g am-margin-top-sm">
              <div class="am-u-sm-4 am-u-md-2 am-text-right">
                	菜单名称:
              </div>
              <div class="am-u-sm-8 am-u-md-4 am-u-end">
                <input type="password" class="am-input-sm" name="password" required>
              </div>
            </div>
            <div class="am-g am-margin-top-sm">
              <div class="am-u-sm-4 am-u-md-2 am-text-right">
                	菜单类型:
              </div>
              <div class="am-u-sm-8 am-u-md-4 am-u-end">
                <input type="password" class="am-input-sm" name="password2" required>
              </div>
            </div>
            <div class="am-g am-margin-top-sm">
              <div class="am-u-sm-4 am-u-md-2 am-text-right">
                	菜单路径:
              </div>
              <div class="am-u-sm-8 am-u-md-4 am-u-end">
                <input type="text" class="am-input-sm" name="phone" required>
              </div>
            </div>
            <div class="am-g am-margin-top-sm">
              <div class="am-u-sm-4 am-u-md-2 am-text-right">
                	夫类菜单:
              </div>
              <div class="am-u-sm-8 am-u-md-4 am-u-end">
                <input type="text" class="am-input-sm" name="email" required>
              </div>
            </div>
	         <div class="am-margin">
		      <button id="save" type="button"class="am-btn am-btn-primary am-btn-xs"
		      data-am-loading="{spinner: 'circle-o-notch', loadingText: '提交中...', resetText: '提交保存'}">提交保存</button>
		      <button type="reset" class="am-btn am-btn-primary am-btn-xs">放弃保存</button>
		    </div>
		    </fieldset>
          </form>  
  </div>

  <footer class="admin-content-footer">
    <hr>
    <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
  </footer>
</div>
<!-- content end -->

</div>

<a href="#" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}"></a>

<footer>
  <hr>
  <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
</footer>

<% include("/common/inc/_js.html"){} %>
<!-- ajax提交表单 -->
  <script
		src="https://cdn.bootcss.com/jquery.form/4.2.2/jquery.form.min.js"></script>
		<!-- 配置文件 -->
	<script type="text/javascript">
		$(function(){
			//异步提交表单
	    	$("#save").click(function(){
	    			var isFormValid = $('#doc-vld-msg').validator('isFormValid');
	    			if (!isFormValid){
	    				$btn.removeClass("am-disabled");
	    				return;
	    			}
	    		//Jquery禁用登录按钮
	    		var $bth = $(this);
	    		$bth.addClass("am-disabled");
	    		$(".am-form").ajaxSubmit({
	    			success:function(data){
	    				$bth.removeClass("am-disabled");
	    				console.log(data);
	    				if(data.errorCode!="0"){
	    					alert(data.errorMsg);
	    					return;
	    				}
	    				//跳转页面
	    				window.location.href="${ctxPath}/auth/user/list";
	    			}
	    		
	    		});
	    	});
		});
	
	</script>
</body>
</html>
